﻿using System;
using System.Collections.Generic;
using System.Web;
using PayRoller.Code;
using System.Web.SessionState;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using HySoft.Cash.Business;
using HySoft.Cash.Structure;
using System.Configuration;
using System.Web.Profile;
using System.Data;


namespace PayRoller.Manage.Reports
{
    public partial class ClientReportSetting : ParentPage, IRequiresSessionState
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.IsPostBack == false)
            {
                this.DisplaySettingsStatus();
            }
        }

        private void DisplaySettingsStatus()
        {
            ReportSettingsBN business = new ReportSettingsBN(this.Page);
            ReportSettingsClientDT setting = business.GetReportSettingsClient(0);
            if (setting != null)
            {
                this.cbAvailableCredit.Checked = setting.IsDisplayAvailableCredit;
                this.cbClientName.Checked = setting.IsDisplayOrgName;
                this.cbCreditBalance.Checked = setting.IsDisplayCreditBalance;
                this.cbCreditLimit.Checked = setting.IsDisplayCreditLimit;
                this.cbEmployeeID.Checked = setting.IsDisplayEmployeeID;
                this.cbEmployeeName.Checked = setting.IsDisplayEmployeeName;
                this.cbOurReference.Checked = setting.IsDisplaySystemReference;
                this.cbEmployeeList.Checked = setting.IsDisplayEmployeeList;
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            ReportSettingsClientDT setting = new ReportSettingsClientDT();
            setting.UserID = 0;
            setting.IsDisplayOrgName = this.cbClientName.Checked;
            setting.IsDisplaySystemReference = this.cbOurReference.Checked;
            setting.IsDisplayEmployeeName = this.cbEmployeeName.Checked;
            setting.IsDisplayEmployeeID = this.cbEmployeeID.Checked;
            setting.IsDisplayCreditLimit = this.cbCreditLimit.Checked;
            setting.IsDisplayCreditBalance = this.cbCreditBalance.Checked;
            setting.IsDisplayAvailableCredit = this.cbAvailableCredit.Checked;
            setting.IsDisplayEmployeeList = this.cbEmployeeList.Checked;

            ReportSettingsBN business = new ReportSettingsBN(this.Page);
            business.OperateReportSettingsClient(setting);
        }
    }
}
